package Model

import "time"

type Salarycheck struct {
	//发薪开始时间
	SalaryStartDate time.Time
	//发薪结束时间
	SalaryEndDate time.Time
	//工资总额
	GrossSalary float64
	//扣除
	Deductions float64
	//实付工资
	NetSalary float64
	//写入支付的方式
	Fields map[string]string
}

//设置各种变量的方法
func (sc *Salarycheck) SetGrossSalary(grosssalary float64) {
	sc.GrossSalary = grosssalary
}

func (sc *Salarycheck) SetDeductions(deductions float64) {
	sc.Deductions = deductions
}

func (sc *Salarycheck) SetNetSalary(netPay float64) {
	sc.NetSalary = netPay
}

func (sc *Salarycheck) SetFiled(name, value string) {
	sc.Fields[name] = value
}

//得到各种变量的方法
func (sc *Salarycheck) GetSalaryEndDate() time.Time {
	return sc.SalaryEndDate
}

func (sc *Salarycheck) GetSalaryStartDate() time.Time {
	return sc.SalaryStartDate
}

func (sc *Salarycheck) GetGrossSalary() float64 {
	return sc.GrossSalary
}

func (sc *Salarycheck) GetDeductions() float64 {
	return sc.Deductions
}

func (sc *Salarycheck) GetNetPay() float64 {
	return sc.NetSalary
}

func (sc *Salarycheck) GetFiled(name string) string {
	return sc.Fields[name]
}

//创建对象
func NewSalarycheck(start, end time.Time) Salarycheck {
	return Salarycheck{SalaryStartDate: start, SalaryEndDate: end}
}
